<?php

/**
 * TbsClientePlan form base class.
 *
 * @method TbsClientePlan getObject() Returns the current form's model object
 *
 * @package    AltargetEcommerce
 * @subpackage form
 * @author     Carlo Lopez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTbsClientePlanForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'clpl_codigo'       => new sfWidgetFormInputHidden(),
      'clpl_fechasusc'    => new sfWidgetFormDate(),
      'clpl_periodicidad' => new sfWidgetFormInputText(),
      'clpl_cupo'         => new sfWidgetFormInputText(),
      'clpl_status'       => new sfWidgetFormInputText(),
      'clpl_codcli'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codcli'), 'add_empty' => false)),
      'clpl_codplan'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codplan'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'clpl_codigo'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('clpl_codigo')), 'empty_value' => $this->getObject()->get('clpl_codigo'), 'required' => false)),
      'clpl_fechasusc'    => new sfValidatorDate(),
      'clpl_periodicidad' => new sfValidatorInteger(),
      'clpl_cupo'         => new sfValidatorInteger(array('required' => false)),
      'clpl_status'       => new sfValidatorString(array('max_length' => 1)),
      'clpl_codcli'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codcli'))),
      'clpl_codplan'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codplan'))),
    ));

    $this->widgetSchema->setNameFormat('tbs_cliente_plan[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TbsClientePlan';
  }

}
